You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'entidadeEmail '' AND (chat_atendido=0 OR chat_atendido=1 OR chat_atendido=5) ' at line 2